home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_gimp.idb / usr / freeware / share / gimp / scripts / rendermap.scm.z / rendermap.scm
Encoding:
Text File  |  1999-07-21  |  2.6 KB  |  75 lines

  1. ;
  2. ;
  3. ;
  4. ; Chris Gutteridge (cjg@ecs.soton.ac.uk)
  5. ; At ECS Dept, University of Southampton, England.
  6.  
  7. ; This program is free software; you can redistribute it and/or modify
  8. ; it under the terms of the GNU General Public License as published by
  9. ; the Free Software Foundation; either version 2 of the License, or
  10. ; (at your option) any later version.
  11. ; This program is distributed in the hope that it will be useful,
  12. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ; GNU General Public License for more details.
  15. ; You should have received a copy of the GNU General Public License
  16. ; along with this program; if not, write to the Free Software
  17. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19.  
  20. (define (script-fu-render-map inSize inGrain inGrad inWiden) 
  21.  
  22.  
  23.         (set! theWidth inSize)
  24.     (set! theHeight inSize)
  25.         (set! theImage (car(gimp-image-new theWidth theHeight RGB)))
  26.  
  27.         (gimp-selection-all theImage)
  28.  
  29.         (set! theLayer (car (gimp-layer-new theImage theWidth theHeight RGBA_IMAGE "I've got more rubber ducks than you!" 100 NORMAL)))
  30.         (gimp-image-add-layer theImage theLayer 0)
  31.         (plug-in-solid-noise TRUE theImage theLayer 1 0 (rand 65536) inGrain inGrain inGrain)
  32.  
  33.     (if (= inWiden TRUE) (begin
  34.             (set! thinLayer (car (gimp-layer-new theImage theWidth theHeight RGBA_IMAGE "Camo Thin Layer" 100 NORMAL)))
  35.             (gimp-image-add-layer theImage thinLayer 0)
  36.         (let     ((theBigGrain (min 15 (* 2 inGrain))))
  37.                      (plug-in-solid-noise TRUE theImage thinLayer 1 0 (rand 65536) theBigGrain theBigGrain theBigGrain)
  38.         )
  39.         (gimp-palette-set-background '(255 255 255))
  40.         (gimp-palette-set-foreground '(0 0 0))
  41.         (let     ((theMask (car(gimp-layer-create-mask thinLayer 0))))
  42.             (gimp-image-add-layer-mask theImage thinLayer theMask)
  43.             (gimp-blend theImage theMask FG-BG-RGB NORMAL LINEAR 100 
  44.                 0 REPEAT-TRIANGULAR FALSE 0 0 0 0 0 (/ theHeight 2) )
  45.         )
  46.         (set! theLayer (car(gimp-image-flatten theImage)))
  47.     ))
  48.     
  49.     (gimp-selection-none theImage)
  50.     (gimp-gradients-set-active inGrad)
  51.     (plug-in-gradmap TRUE theImage theLayer)
  52.         (gimp-display-new theImage)
  53. )
  54.  
  55.  
  56.  
  57. ; Register the function with the GIMP:
  58.  
  59. (script-fu-register
  60.  "script-fu-render-map"
  61.  "<Toolbox>/Xtns/Script-Fu/Patterns/Render Map"
  62.  "foo"
  63.  "Chris Gutteridge: cjg@ecs.soton.ac.uk"
  64.  "28th April 1998"
  65.  "Chris Gutteridge / ECS @ University of Southampton, England"
  66.  ""
  67.  SF-VALUE "Image Size:" "256"
  68.  SF-VALUE "Granularity (0 - 15):" "4"
  69.  SF-VALUE "Gradient:" "\"Land_and_Sea\""
  70.  SF-TOGGLE "TRUE = Detail in middle, FALSE = tile" FALSE
  71. )
  72.  
  73.